// ### 作业：创建一个学生表,里面有班级字段,里面最好有自己班上同学姓名,其它班级的姓名随机写,有个字段存储游戏的分值,先实现随机的数值写入,查询出各班级前三名的学生

let mysql=require ('mysql');
let h=mysql.createConnection({host:'127.0.0.1',user:'root',password:'root',port:'3306',database:'cxy'});
h.connect();

let t=new Date();
let time=t.getFullYear()+"/"+(t.getMonth()+1)+"/"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();

let score=Math.floor(Math.random()*101);


let max7="select * from user   where class=7  order by sore  desc limit 3";
h.query(max7,(err,date)=>{
    console.log(err);
    console.log(date)
})

let max6="select * from user   where class=6  order by sore  desc limit 3";
h.query(max6,(err,date)=>{
    console.log(err);
    console.log(date)
})

let max5="select * from user   where class=5  order by sore  desc limit 3";
h.query(max5,(err,date)=>{
    console.log(err);
    console.log(date)
})
h.end();